﻿// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'

Shader "Custom/C"
{
	Properties
	{
		_A("A背景颜色", Color) = (1, 1, 1, 1)
		_B("B背景颜色", Color) = (1, 1, 1, 1)
	}
		SubShader
		{
			Pass
			{
				///这段 是 Bshader 独有的 ，在Ashader中请删掉
				Tags {"Queue" = "Transparent" "RenderType" = "Transparent" }
				Blend Zero Zero
		Cull Off
			Lighting Off
			ZTest Always
			ZWrite Off
			///
			CGPROGRAM
			#pragma vertex vert
			#pragma fragment frag
			//从程序传染顶点渲染器的数据
			struct a2v
			{
				float4 vertex : POSITION;
				float2 uv : TEXCOORD0;
			};
		//从顶点渲染器传入片元渲染器的数据
		struct v2f
		{
			float4 position : SV_POSITION;
			float2 uv : TEXCOORD0;
		};

		//格子背景
		fixed4 _A;
		fixed4 _B;

		//顶点着色器
		v2f vert(a2v v)
		{
			v2f o;
			//将像素空间从模型转为裁剪空间
			o.position = UnityObjectToClipPos(v.vertex);
			o.uv = v.uv;
			return o;

		}
		//片段着色器
		fixed4 frag(v2f o) : COLOR
		{
		//合成贴图、遮罩、线的像素
		return _A- half4(0.5,0.0,0.0,0.0);
	}
	ENDCG
}
		}
}